package com.yanq.liancar.adapter;

import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yanq.liancar.R;
import com.yanq.liancar.bean.HomeBean;
import com.yanq.liancar.viewholder.ItemHomeViewHolder;

import java.util.List;

/**
 * Created by wyq on 2018/5/22.
 */

public class HomeAdapter extends BaseQuickAdapter<HomeBean, BaseViewHolder> {


    public HomeAdapter(int layoutResId, @Nullable List<HomeBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, HomeBean item) {
        helper.setText(R.id.title,item.getName())
                .setText(R.id.tv_marquee, "¥"+item.getPrice().toString())
                .setText(R.id.score,item.getIntegral());
        ImageView imageView=helper.getView(R.id.img);
        imageView.setImageResource(item.getImage());
        TextView textView=helper.getView(R.id.tv_marquee);
        textView.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG ); //中间横线（删除线）

    }
}
